﻿#include "appmonitor.h"

AppMonitor::AppMonitor(long id,QString & name, QString & startCmd, int monitorType, QString &cfgInfo, int checkIntervalSeconds, int maxMemLimitKB)\
    :id(id),name(name), startCmd(startCmd), type(monitorType),cfgInfo(cfgInfo), checkIntervalSeconds(checkIntervalSeconds), maxMemLimitKB(maxMemLimitKB)

{

}
AppMonitor::AppMonitor()
{

}

QString AppMonitor::getTypeName()
{
    if(type == MonitorType_pid)
    {
        return "进程ID";
    }
    else if(type == MonitorType_appName)
    {
        return "进程名称";
    }
    else if(type == MonitorType_listenSocket)
    {
        return "监听端口";
    }
    else
    {
        return "unKnown";
    }
}

QString AppMonitor::getWorkPath()
{
    return QString::fromStdString(getParentFilePath(startCmd.toStdString()));
}
